package Work.Set;

import java.sql.SQLOutput;
import java.util.HashSet;
import java.util.Set;

public class TestSetuse {
    public static void main(String[] args) {
        Set<String> run = new HashSet<>();
        run.add("韬");
        run.add("小明");

        Set<String> rs = new HashSet<>();
        rs.add("韬");
        rs.add("老莫");
        rs.add("小张");

        run.addAll(rs);
        System.out.println("参加了项目的同学："+ run);

        run.remove("小张");
        run.remove("老莫");
        System.out.println("参加了跑步的同学：" + run);

        System.out.println("参加了跳绳的同学：" + rs);

        run.retainAll(rs);
        System.out.println("跑步和跳绳都参加的同学：" + run);

        rs.remove("韬");
        System.out.println("只参加跳绳没参加跑步的同学：" + rs);
    }
}
